package com.itheima.threadpool;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class Demo2 {
    public static void main(String[] args) {
        ThreadPoolExecutor tpe = new ThreadPoolExecutor(2,5,2,
                TimeUnit.SECONDS,new ArrayBlockingQueue<>(10),
                Executors.defaultThreadFactory(),
                new ThreadPoolExecutor.DiscardPolicy());

        tpe.submit(()-> System.out.println(Thread.currentThread().getName()+"执行了"));

        tpe.submit(()-> System.out.println(Thread.currentThread().getName()+"执行了"));

        tpe.shutdown();
    }
}
